import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { store, key } from './store'
import ElementPlus from './plugins/element-plus'
import './styles/index.scss' // 加载全局样式
import components from '@/components'

const app = createApp(App)
app.config.globalProperties.$filters = {
  dateFormat(value) {
    const dt = new Date(value);
    const y = dt.getFullYear();
    const m = (dt.getMonth() + 1 + '').padStart(2, '0');
    const d = (dt.getDate() + '').padStart(2, '0');

    const hh = (dt.getHours() + '').padStart(2, '0');
    const mm = (dt.getMinutes() + '').padStart(2, '0');
    const ss = (dt.getSeconds() + '').padStart(2, '0');

    return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
  }
}
app.use(router)
app.use(store, key)
app.use(ElementPlus)
app.use(components)
app.mount('#app')
